const { HYEventStore } = require('hy-event-store')
const axios = require('axios')
store = new HYEventStore({
  state: {
    name: 'xjh',
    age: 10,
    // 网络数据
    banners: [],
    recommands: []
  },
  actions: {
    async getHomeDataAction(ctx, payload) {
      const ret = await axios.get('http://123.207.32.32:8000/home/multidata')
      ctx.banners = ret.data.data.banner.list
      ctx.recommands = ret.data.data.recommend.list
    }
  }
})

store.dispatch('getHomeDataAction',123)


store.onState('banners', (res) => {
  console.log('banner', res)
})

store.onState('recommands', (res) => {
  console.log('recommands', res)
})
